import request from "@/utils/request";

// 获取角色分页列表
export const reqRoleList = (page, limit, roleName = "") => {
  return request.get(`/admin/acl/role/${page}/${limit}?roleName=${roleName}`);
};

// 获取分配角色列表
export const reqToAssign = (roleId) => {
  return request.get(`/admin/acl/permission/toAssign/${roleId}`);
};

// 分配权限
export const reqDoAssign = (roleId, permissionId) => {
  return request.post(
    `/admin/acl/permission/doAssign`,
    {},
    {
      params: {
        roleId,
        permissionId: permissionId.join(","),
      },
    }
  );
};

// 添加角色 /admin/acl/role/save
export const reqAddRoleName = (roleName) => {
  return request.post(`/admin/acl/role/save`, {
    roleName,
  });
};
